package main

import (
	"fmt"
	"mass-user/server/model"

	"net"
)

func process(conn net.Conn) {
	//defer conn.Close()
	p := &Processor{
		Conn:conn,
	}
	err:= p.process()
	if err != nil {
		return
	}
}

func initUserDao()  {
	model.NewUserDao(pool)
}

func main() {
	InitPool("192.168.44.128:6379")
	initUserDao()
	listen, err := net.Listen("tcp", "127.0.0.1:8888")
	if err != nil {
		fmt.Println("服务器启动失败！err=", err)
	}
	defer listen.Close()
	for {
		fmt.Println("等待客户端连接！")
		conn, err := listen.Accept()
		defer conn.Close()
		if err != nil {
			fmt.Println("listen.Accept() error = ", err)
		}
		go process(conn)
	}
}
